﻿
using FieldTools.Client.Entity.Model;
using FieldTools.Client.Model.Base;
using FieldTools.Util;

namespace FieldTools.Client.Entity.MyQQ
{
    public class RobotConfig
    {
        public string Posturl { get; set; }
        public string Token { get; set; }
        public string JsFilePath { get; set; }
        public bool IsHandleJS { get; set; }
        public bool IsSaveQQInfo { get; set; }
        public List<RobotMaster> RobotMasters { get; set; }
        public List<OrderData> CustonOrders { get; set; }
    }

    /// <summary>
    /// 机器人连接配置
    /// </summary>
    public class RobotConnectConfig
    {
        public RobotConnectConfig() : base()
        {

        }
        private string postUrl = "http://192.168.0.101";
        /// <summary>
        /// post地址
        /// </summary>
        public string PostUrl
        {
            get { return postUrl; }
            set { postUrl = value;}
        }

        private string token = string.Empty;
        /// <summary>
        /// token
        /// </summary>
        public string Token
        {
            get { return token; }
            set { token = value;}
        }
    }

    /// <summary>
    /// 指令类
    /// </summary>
    public class OrderData : CustomScript
    {
        /// <summary>
        /// 默认构造
        /// </summary>
        public OrderData()
        {
            Keyword = "默认关键字";
            ScriptContent = "默认回复";
            IsOn = false;
            IsAt = false;
            IsPrivate = true;
            ScriptType = ScriptType.纯文本;
            Remark = "备注";
        }
        /// <summary>
        /// 关键字
        /// </summary>
        public string Keyword { get; set; }
        /// <summary>
        /// 是否开启
        /// </summary>
        public bool IsOn { get; set; }
        /// <summary>
        /// 是否开启仅被艾特时候触发
        /// </summary>
        public bool IsAt { get; set; }
        /// <summary>
        /// 是否开启仅私聊时候触发
        /// </summary>
        public bool IsPrivate { get; set; }
        /// <summary>
        /// 备注
        /// </summary>
        public string? Remark { get; set; }
    }

    /// <summary>
    /// 机器人管理员关联对象
    /// </summary>
    public class RobotMaster
    {
        /// <summary>
        /// 键
        /// </summary>
        public string Id { get; set; } = CustomApi.idHelper.NextId().ToString();
        /// <summary>
        /// 机器人
        /// </summary>
        public string? RobotQQ { get; set; }
        /// <summary>
        /// 管理员
        /// </summary>
        public string? MasterQQ { get; set; }
        /// <summary>
        /// 是否启用
        /// </summary>
        public bool IsOn { get; set; }
        /// <summary>
        /// 备注
        /// </summary>
        public string? Remark { get; set; }
    }

    /// <summary>
    /// 机器人任务
    /// </summary>
    public class RobotTask : CustomScript
    {
        /// <summary>
        /// Cron表达式，用于周期执行
        /// </summary>
        public string? Cron { get; set; }
        /// <summary>
        /// 目标，qq号码或群号
        /// </summary>
        public long Target { get; set; }
        /// <summary>
        /// 目标类型，0私，1群
        /// </summary>
        public int TargetType { get; set; } = 0;
        /// <summary>
        /// 任务类型，0私聊发送信息，1群聊发送信息，其他todo
        /// </summary>
        public int TaskType { get; set; }
        /// <summary>
        /// 是否启用
        /// </summary>
        public bool IsOn { get; set; }
        /// <summary>
        /// 备注
        /// </summary>
        public string? Remark { get; set; }
    }
}
